<?php
/*
	Sponsor Manager (login.php file)
    Copyright (C) <Fri Feb 08 21:39:21 CET 2008>  Marcos Ramírez <marcosramirez@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 */
global $html;
global $user;
global $error;


if ($_POST['userlogin'] && $_POST['userpass']) {
	$res=$user->checkLogin($_POST['userlogin'], $_POST['userpass']);
	if ($res==0) {
		$_SESSION['loggedin']=1;
		header('Location: '.$Cfg['Sys']['webDir']);
		die();
	}
} else {
	showform();
}


// Template begin

function showform () {
global $html;
$html->setTitle(_('Enter login'));
$html->header();
//showform();
//$html->footer;
	
echo '<form method="post" action="'.$Cfg['Sys']['webDir'].'?section=login">
user:<input type="text" name="userlogin"><br />
pass: <input type="password" name="userpass"><br />
<input type="submit" value="'._('Log in').'">
</form>';
$html->footer();
}

?>